package modele;

import javax.swing.table.AbstractTableModel;

public class TableModel extends AbstractTableModel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Object[][] data;
	private String[] header;
	private ModeleP myModele;
	
	public TableModel(ModeleP modele){
		this.myModele=modele;
		data=modele.getSousCollec().getDataTable();
		header=modele.getSousCollec().getHeadTable();
	}
	public String getColumnName(int col){
		return this.header[col];
	}
	@Override
	public int getColumnCount() {
		return header.length;
	}

	@Override
	public int getRowCount() {
		return data.length;
	}

	@Override
	public Object getValueAt(int arg0, int arg1) {
		return data[arg0][arg1];
	}
    public void changedData(){
    	data = myModele.getSousCollec().getDataTable();
    	super.fireTableDataChanged();
    }
    public boolean isCellEditable(int row, int col){
        return false;
    }

}
